package basic.com.liz.learn.design.singleton;

public class SingletonTest
{
    
    public static void main(String[] args)
    {
        
        TestSingleTon ts1 = TestSingleTon.getInstance();
        ts1.setName("jaso2n");
        ts1.printInfo();
        
        TestSingleTon ts2 = TestSingleTon.getInstance();
        ts2.setName("05329");
        
        System.out.println(ts1.getClass().getName());
        
        ts1.printInfo();
        
        ts2.printInfo();
        
        if (ts1 == ts2)
        {
            System.out.println("创建的是同一个实例");
        }
        else
        {
            System.out.println("创建的不是同一个实例");
        }
    }
}
